<?php
// выбор страницы
if (! isset ( $_GET ["tab"] )) {
	tabDetails_1 ();
} else {
	switch ($_GET ["tab"]) {
		case 2 :
			{
				tabDetails_2 ();
				break;
			}
		case 3 :
			{
				tabDetails_3 ();
				break;
			}
		default :
			{
				tabDetails_1 ();
				break;
			}
	}
}

// описание
function tabDetails_1() {
	global $_MYSQL, $_Lang, $_SEF, $_TPL, $_Main;
	$tmpT = array ("site-title" => "", "site-links" => "<h>/search-full</h><t>Поиск легкового автомобиля</t>", "car-href_1" => "{site_url}/car/" . $_GET [1], "car-href" => "{site_url}/car/" . $_GET [1], "car-name" => "", "car-img" => "", "car-info_short" => "", "car-info" => "", "car-options" => "", "car-other" => "", "diler-type" => "", "diler-info" => "" );
	// формирование href
	$search_href = $_SEF->SearchPageLink ();
	$tmpT ["car-href"] .= $search_href ["s_query"];
	if ($search_href ["s_query"] != "") {
		$tmpT ["car-href"] .= "&";
	} else {
		$tmpT ["car-href"] .= "?";
	}
	if ($search_href ["s_url"] != "") {
		$tmpT ["site-links"] .= "<h>" . $search_href ["s_url"] . $search_href ["s_back"] . "</h><t>Результаты поиска</t>";
	}
	// id машины
	$car_ID = $_GET [1];
	$_CAR = $_MYSQL->SELECT ( "SELECT `car`.*, `i`.*, `o`.*, `c`.*, `p`.*, `f`.*, `d`.`dialer-id` FROM `{p}cars` `car` LEFT OUTER JOIN `{p}car-colors` `c` ON `c`.`car-id` = `car`.`car-id` LEFT OUTER JOIN `{p}car-options` `o` ON `o`.`car-id` = `car`.`car-id` LEFT OUTER JOIN `{p}car-images` `i` ON `i`.`car-id` = `car`.`car-id` LEFT OUTER JOIN `{p}car-price` `p` ON `p`.`car-id` = `car`.`car-id` LEFT OUTER JOIN `{p}car-fuels` `f` ON `f`.`car-id` = `car`.`car-id` LEFT OUTER JOIN `{p}car-dialer` `d` ON `d`.`car-id` = `car`.`car-id` WHERE `car`.`car-id` = " . $car_ID . " GROUP BY `car`.`car-id`" );
	if (! $_CAR) {
		$_Main->Page404 ();
		return 0;
	}
	$_Dialer = $_MYSQL->SELECT ( "SELECT * FROM `{p}dialers` WHERE `di-id` = " . $_CAR ["dialer-id"] );
	// ссылки на марки - модели
	$_SELECT = $_MYSQL->SELECT ( "SELECT `ma-name`, `ma-id`, `mo-name`, `mo-code` FROM `{p}marks`, `{p}models`, `{p}car-markmodel` WHERE `{p}car-markmodel`.`car-id` = " . $car_ID . " AND `{p}car-markmodel`.`mark-id` = `{p}marks`.`ma-id` AND `{p}car-markmodel`.`model-id` = `{p}models`.`mo-id`" );
	if ($_SELECT) {
		$tmpT ["site-links"] .= "<h>/mark/" . $_SEF->Encode ( $_SELECT ["ma-name"] ) . "</h><t>" . $_SELECT ["ma-name"] . "</t>";
		$tSELECT = $_MYSQL->SELECT ( "SELECT `mo-name` FROM `{p}models` WHERE `mark-id` = " . $_SELECT ["ma-id"] . " AND `mo-group` LIKE '%" . $_SELECT ["mo-code"] . "%'" );
		if ($tSELECT) {
			$tmpT ["site-links"] .= "<h>/model/" . $_SEF->Encode ( $_SELECT ["ma-name"] ) . "/" . $_SEF->Encode ( $tSELECT ["mo-name"] ) . "</h><t>" . $tSELECT ["mo-name"] . "</t>";
		}
		$tmpT ["site-links"] .= "<h>/model/" . $_SEF->Encode ( $_SELECT ["ma-name"] ) . "/" . $_SEF->Encode ( $_SELECT ["mo-name"] ) . "</h><t>" . $_SELECT ["mo-name"] . "</t>";
	}
	// элементы
	$_TPL->Load ( "elements", "img" );
	$_TPL->Load ( "elements", "span" );
	$_TPL->Load ( "tabDetail_1", "tr" );
	# имя
	$tmpT ["car-name"] = $_CAR ["car-name"];
	;
	$tmpT ["site-title"] = "Купить " . $tmpT ["car-name"] . " из Германии, продажа, стоимость, цены на autode.net";
	$tmpT ["site-links"] .= "<h></h><t>" . $_CAR ["car-name"] . "</t>";
	# изображение
	if ($_CAR ["i-full"] == "") {
		$_CAR ["i-full"] = "/images/no_carBig.gif";
	}
	$tmpT ["car-img"] = $_TPL->Show ( "img", array ("width" => 200, "height" => 150, "class" => "big", "alt" => $_CAR ["car-name"], "src" => $_CAR ["i-full"] ) );
	# краткое инфо
	// торг
	if ($_CAR ["p-torg"] != 0) {
		$tmpT ["car-info_short"] .= $_TPL->Show ( "span", array ("class" => "gray", "text" => "Торг" ), TPL_NOCLEAR );
	}
	// цена
	$tmpT ["car-info_short"] .= $_TPL->Show ( "span", array ("class" => "black", "text" => "<strong>" . $_CAR ["p-price"] . " " . $_CAR ["p-price-cur"] . "</strong>" ), TPL_NOCLEAR );
	// брутто, нетто
	if ($_CAR ["p-brutto"] == 1) {
		$tmpT ["car-info_short"] .= "<strong> (Брутто)</strong><br />" . $_CAR ["p-netto"] . " " . $_CAR ["p-netto-cur"] . "(Нетто)";
	}
	$tmpT ["car-info_short"] .= "<br />";
	$tmpT ["car-info_short"] .= $_TPL->Show ( "span", array ("class" => "gray", "text" => ($_CAR ["p-nds-recov"] == 1) ? ($_CAR ["p-nds"]) : ("НДС не возвращается") ), TPL_NOCLEAR ) . "<br /><br />";
	// поврежденное
	if ($_CAR ["car-damaged"] == 1) {
		$tmpT ["car-info_short"] .= $_TPL->Show ( "span", array ("class" => "gray", "text" => "<strong>" . $_Lang->Text ["car-damaged"] . "</strong>" ), TPL_NOCLEAR ) . "<br />";
	}
	// тип
	$tmpT ["car-info_short"] .= "<strong>" . $_Lang->carText [$_CAR ["car-type"]] . "</strong><br />";
	// новый авто
	$tmpT ["car-info_short"] .= "<strong>" . (($_CAR ["car-new"] == 1) ? ($_Lang->Text ["car-new"]) : ($_Lang->Text ["car-old"])) . "</strong><br />";
	// первая регистрация
	if ($_CAR ["car-freg"] != "0000-00-00") {
		$tmpT ["car-info_short"] .= "П.р. " . $_CAR ["car-freg"] . "<br />";
	}
	// пробег
	if ($_CAR ["car-mileage"] != 0) {
		$tmpT ["car-info_short"] .= $_CAR ["car-mileage"] . " км <br />";
	}
	// тип топлива
	foreach ( $_Lang->fuel as $o => $v ) {
		if ($_CAR [$o] == 1) {
			$tmpT ["car-info_short"] .= $v . "<br />";
			break;
		}
	}
	// мощность
	if ($_CAR ["car-power"] != 0) {
		$tmpT ["car-info_short"] .= $_CAR ["car-power"] . " кВт (" . ceil ( $_CAR ["car-power"] * 1.36 ) . " PS) <br />";
	}
	// коробка передач
	$tmpT ["car-info_short"] .= $_Lang->gearText [$_CAR ["car-gearbox"]];
	# продавец
	// тип продавца
	$tmpT ["diler-type"] = $_Dialer ["di-type"];
	if ($_Dialer ["di-name"] != "") {
		$tmpT ["diler-info"] .= $_TPL->Show ( "img", array ("width" => 10, "height" => 8, "class" => "", "alt" => "", "src" => "/images/m_1.gif" ), TPL_NOCLEAR ) . "<a href=\"" . $_Dialer ["di-href"] . "\">" . $_Dialer ["di-name"] . "</a><br />";
	}
	$tmpT ["diler-info"] .= $_Dialer ["di-info"];
	# Другие технические характеристики
	// объем
	if ($_CAR ["car-eng_volume"] != "") {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["car-eng_volume"], "td2" => $_CAR ["car-eng_volume"] ), TPL_NOCLEAR );
	}
	// число мест
	if ($_CAR ["car-n_seats"] != 0) {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["car-n_seats"], "td2" => $_CAR ["car-n_seats"] ), TPL_NOCLEAR );
	}
	#   Расход топлива
	// комбинированный:
	if ($_CAR ["car-fuel_rcomb"] != "") {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["car-fuel_rcomb"], "td2" => $_CAR ["car-fuel_rcomb"] ), TPL_NOCLEAR );
	}
	// городской
	if ($_CAR ["car-fuel_rcity"] != "") {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["car-fuel_rcity"], "td2" => $_CAR ["car-fuel_rcity"] ), TPL_NOCLEAR );
	}
	// загородный
	if ($_CAR ["car-fuel_rcountry"] != "") {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["car-fuel_rcountry"], "td2" => $_CAR ["car-fuel_rcountry"] ), TPL_NOCLEAR );
	}
	// CO2
	if ($_CAR ["car-co2_comb"] != "") {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["car-co2_comb"], "td2" => $_CAR ["car-co2_comb"] ), TPL_NOCLEAR );
	}
	// Число дверей:
	if ($_CAR ["car-n_dors"] != 0) {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["car-n_dors"], "td2" => $_CAR ["car-n_dors"] . "/" . ($_CAR ["car-n_dors"] + 1) ), TPL_NOCLEAR );
	}
	// Класс экологической безопасности:
	if ($_CAR ["car-safe-class"] != 0) {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["car-safe-class"], "td2" => "Евро" . $_CAR ["car-safe-class"] ), TPL_NOCLEAR );
	}
	// наклейка
	if ($_CAR ["car-safe-label"] != 0) {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["car-safe-label"], "td2" => $_CAR ["car-safe-label"] . " " . $_Lang->safeLabe [$_CAR ["car-safe-label"]] ), TPL_NOCLEAR );
	}
	// Количество владельцев транспортного средства:
	if ($_CAR ["car-n_owners"] != 0) {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["car-n_owners"], "td2" => $_CAR ["car-n_owners"] ), TPL_NOCLEAR );
	}
	// Общий осмотр:
	if ($_CAR ["o-check"] != "0000-00-00") {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["o-check"], "td2" => $_CAR ["o-check"] ), TPL_NOCLEAR );
	}
	// Ежегодная проверка на уровень выбросов:
	if ($_CAR ["o-ever-check"] != "0000-00-00") {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["o-ever-check"], "td2" => $_CAR ["o-ever-check"] ), TPL_NOCLEAR );
	}
	// Климатическая установка:
	if ($_CAR ["car-climat-contr"] != 0) {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["car-climat-contr"], "td2" => $_Lang->climText [$_CAR ["car-climat-contr"]] ), TPL_NOCLEAR );
	}
	// Цвет:
	$str = "";
	foreach ( $_Lang->color as $o => $v ) {
		if ($_CAR [$o] == 1) {
			$str .= $v . " ";
		}
	}
	if ($str != "") {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => "Цвет", "td2" => $str ), TPL_NOCLEAR );
	}
	# характеристики
	$opt = "";
	foreach ( $_Lang->optionArr as $o ) {
		if ($_CAR [$o] == 1) {
			if ($opt != "") {
				$opt .= ", ";
			}
			$opt .= $_Lang->Text [$o];
		}
	}
	$tmpT ["car-options"] = $opt;
	# Описание 
	//$tmpT["car-other"] = $_CAR["o-info"];
	$_TPL->Clear ( "img" );
	$_TPL->Clear ( "span" );
	$_TPL->Clear ( "tr" );
	// формаирование страницы
	$_Main->MakePage ( "tabDetail_1", $tmpT, "page-detail" );
	return 0;
}
// характеристики
function tabDetails_2() {
	global $_MYSQL, $_Lang, $_SEF, $_TPL, $_Main;
	$tmpT = array ("site-title" => "", "site-links" => "<h>/search-full</h><t>Поиск легкового автомобиля</t>", "car-href_1" => "{site_url}/car/" . $_GET [1], "car-href" => "{site_url}/car/" . $_GET [1], "car-name" => "", "car-img" => "", "car-imgall" => "" );
	// ссылки
	$hrefArr = $_SEF->SearchPageLink ();
	$tmpT ["car-href"] .= $hrefArr ["s_query"];
	if ($hrefArr ["s_query"] != "") {
		$tmpT ["car-href"] .= "&";
	} else {
		$tmpT ["car-href"] .= "?";
	}
	if ($hrefArr ["s_url"] != "") {
		$tmpT ["site-links"] .= "<h>" . $hrefArr ["s_url"] . $hrefArr ["s_back"] . "</h><t>Результаты поиска</t>";
	}
	// id машины
	$car_ID = $_GET [1];
	$_CAR = $_MYSQL->SELECT ( "SELECT `car`.`car-name`, `i`.* FROM `{p}cars` `car` LEFT OUTER JOIN `{p}car-images` `i` ON `i`.`car-id` = `car`.`car-id` WHERE `car`.`car-id` = " . $car_ID, MYSQL_SALL );
	if (! $_CAR) {
		$_Main->Page404 ();
		return 0;
	}
	// ссылки на марки - модели
	$_SELECT = $_MYSQL->SELECT ( "SELECT `ma-name`, `ma-id`, `mo-name`, `mo-code` FROM `{p}marks`, `{p}models`, `{p}car-markmodel` WHERE `{p}car-markmodel`.`car-id` = " . $car_ID . " AND `{p}car-markmodel`.`mark-id` = `{p}marks`.`ma-id` AND `{p}car-markmodel`.`model-id` = `{p}models`.`mo-id`" );
	if ($_SELECT) {
		$tmpT ["site-links"] .= "<h>/mark/" . $_SEF->Encode ( $_SELECT ["ma-name"] ) . "</h><t>" . $_SELECT ["ma-name"] . "</t>";
		$tSELECT = $_MYSQL->SELECT ( "SELECT `mo-name` FROM `{p}models` WHERE `mark-id` = " . $_SELECT ["ma-id"] . " AND `mo-group` LIKE '%" . $_SELECT ["mo-code"] . "%'" );
		if ($tSELECT) {
			$tmpT ["site-links"] .= "<h>/model/" . $_SEF->Encode ( $_SELECT ["ma-name"] ) . "/" . $_SEF->Encode ( $tSELECT ["mo-name"] ) . "</h><t>" . $tSELECT ["mo-name"] . "</t>";
		}
		$tmpT ["site-links"] .= "<h>/model/" . $_SEF->Encode ( $_SELECT ["ma-name"] ) . "/" . $_SEF->Encode ( $_SELECT ["mo-name"] ) . "</h><t>" . $_SELECT ["mo-name"] . "</t>";
	}
	// элементы
	$_TPL->Load ( "elements", "img" );
	// имя
	$tmpT ["car-name"] = $_CAR [0] ["car-name"];
	$tmpT ["site-title"] = "Купить " . $tmpT ["car-name"] . " из Германии, продажа, стоимость, цены на autode.net";
	$tmpT ["site-links"] .= "<h></h><t>" . $tmpT ["car-name"] . "</t>";
	// изображение
	foreach ( $_CAR as $car ) {
		if ($car ["i-full"] != "") {
			if (isset ( $_GET ["img-id"] ) && $_GET ["img-id"] == $car ["i-id"]) {
				$tmpT ["car-img"] = $_TPL->Show ( "img", array ("src" => $car ["i-full"], "class" => "big", "width" => "", "height" => "", "alt" => $tmpT ["car-name"] ), TPL_NOCLEAR );
			}
			$tmpT ["car-imgall"] .= "<a href=\"" . $tmpT ["car-href"] . "tab=2&img-id=" . $car ["i-id"] . "\" class=\"galery\">" . $_TPL->Show ( "img", array ("src" => $car ["i-thumb"], "width" => 64, "height" => 48, "class" => "small", "alt" => $tmpT ["car-name"] ), TPL_NOCLEAR ) . "</a>";
		}
	}
	if ($tmpT ["car-img"] == "") {
		if ($_CAR [0] ["i-full"] == "") {
			$_CAR [0] ["i-full"] = "/images/no_carBig.gif";
		}
		$tmpT ["car-img"] = $_TPL->Show ( "img", array ("src" => $_CAR [0] ["i-full"], "class" => "big", "width" => "", "height" => "", "alt" => $tmpT ["car-name"] ), TPL_NOCLEAR );
	}
	$_TPL->Clear ( "img" );
	// формаирование страницы */
	$_Main->MakePage ( "tabDetail_2", $tmpT, "page-detail" );
	return 0;
}
function tabDetails_3() {
	global $_MYSQL, $_Lang, $_SEF, $_TPL, $_Main;
	$tmpT = array ("site-title" => "", "site-links" => "<h>/search-full</h><t>Поиск легкового автомобиля</t>", "car-href_1" => "{site_url}/car/" . $_GET [1], "car-href" => "{site_url}/car/" . $_GET [1], "car-name" => "", "car-type" => "", "car-info" => "", "car-options" => "", "car-other" => "" );
	// ссылки
	$hrefArr = $_SEF->SearchPageLink ();
	$tmpT ["car-href"] .= $hrefArr ["s_query"];
	if ($hrefArr ["s_query"] != "") {
		$tmpT ["car-href"] .= "&";
	} else {
		$tmpT ["car-href"] .= "?";
	}
	if ($hrefArr ["s_url"] != "") {
		$tmpT ["site-links"] .= "<h>" . $hrefArr ["s_url"] . $hrefArr ["s_back"] . "</h><t>Результаты поиска</t>";
	}
	// id машины
	$car_ID = $_GET [1];
	$_CAR = $_MYSQL->SELECT ( "SELECT `car`.*, `i`.*, `o`.*, `c`.*, `p`.*, `f`.*, `d`.`dialer-id`, `dec`.* FROM `{p}cars` `car` LEFT OUTER JOIN `{p}car-colors` `c` ON `c`.`car-id` = `car`.`car-id` LEFT OUTER JOIN `{p}car-options` `o` ON `o`.`car-id` = `car`.`car-id` LEFT OUTER JOIN `{p}car-images` `i` ON `i`.`car-id` = `car`.`car-id` LEFT OUTER JOIN `{p}car-price` `p` ON `p`.`car-id` = `car`.`car-id` LEFT OUTER JOIN `{p}car-fuels` `f` ON `f`.`car-id` = `car`.`car-id` LEFT OUTER JOIN `{p}car-dialer` `d` ON `d`.`car-id` = `car`.`car-id` LEFT OUTER JOIN `{p}car-decors` `dec` ON `dec`.`car-id` = `car`.`car-id` WHERE `car`.`car-id` = " . $car_ID . " GROUP BY `car`.`car-id`" );
	if (! $_CAR) {
		$_Main->Page404 ();
		return 0;
	}
	// ссылки на марки - модели
	$_SELECT = $_MYSQL->SELECT ( "SELECT `ma-name`, `ma-id`, `mo-name`, `mo-code` FROM `{p}marks`, `{p}models`, `{p}car-markmodel` WHERE `{p}car-markmodel`.`car-id` = " . $car_ID . " AND `{p}car-markmodel`.`mark-id` = `{p}marks`.`ma-id` AND `{p}car-markmodel`.`model-id` = `{p}models`.`mo-id`" );
	if ($_SELECT) {
		$tmpT ["site-links"] .= "<h>/mark/" . $_SEF->Encode ( $_SELECT ["ma-name"] ) . "</h><t>" . $_SELECT ["ma-name"] . "</t>";
		$tSELECT = $_MYSQL->SELECT ( "SELECT `mo-name` FROM `{p}models` WHERE `mark-id` = " . $_SELECT ["ma-id"] . " AND `mo-group` LIKE '%" . $_SELECT ["mo-code"] . "%'" );
		if ($tSELECT) {
			$tmpT ["site-links"] .= "<h>/model/" . $_SEF->Encode ( $_SELECT ["ma-name"] ) . "/" . $_SEF->Encode ( $tSELECT ["mo-name"] ) . "</h><t>" . $tSELECT ["mo-name"] . "</t>";
		}
		$tmpT ["site-links"] .= "<h>/model/" . $_SEF->Encode ( $_SELECT ["ma-name"] ) . "/" . $_SEF->Encode ( $_SELECT ["mo-name"] ) . "</h><t>" . $_SELECT ["mo-name"] . "</t>";
	}
	// элементы
	$_TPL->Load ( "elements", "img" );
	$_TPL->Load ( "tabDetail_3", "tr" );
	// имя
	$tmpT ["car-name"] = $_CAR ["car-name"];
	$tmpT ["site-title"] = "Купить " . $tmpT ["car-name"] . " из Германии, продажа, стоимость, цены на autode.net";
	$tmpT ["site-links"] .= "<h></h><t>" . $tmpT ["car-name"] . "</t>";
	// тип
	$tmpT ["car-type"] .= $_Lang->carText [$_CAR ["car-type"]] . " ";
	// новый авто
	$tmpT ["car-type"] .= "" . (($_CAR ["car-new"] == 1) ? ($_Lang->Text ["car-new"]) : ($_Lang->Text ["car-old"])) . " ";
	// поврежденное
	if ($_CAR ["car-damaged"] == 1) {
		$tmpT ["car-type"] .= "<br />" . $_TPL->Show ( "span", array ("class" => "gray", "text" => $_Lang->Text ["car-damaged"] ), TPL_NOCLEAR );
	}
	// цена
	$price = "<strong>" . $_CAR ["p-price"] . " " . $_CAR ["p-price-cur"] . "</strong>";
	// брутто, нетто
	if ($_CAR ["p-brutto"] == 1) {
		$price .= "<strong> (Брутто)</strong><br />" . $_CAR ["p-netto"] . " " . $_CAR ["p-netto-cur"] . "(Нетто)";
	}
	if ($_CAR ["p-nds-recov"] == 1) {
		$price .= "<br />" . $_TPL->Show ( "span", array ("class" => "gray", "text" => $_CAR ["p-nds"] ), TPL_NOCLEAR );
	} else {
		$price .= "<br />" . $_TPL->Show ( "span", array ("class" => "gray", "text" => "НДС не возвращается" ), TPL_NOCLEAR ) . "<br />";
	}
	$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => "Цена", "td2" => $price ), TPL_NOCLEAR );
	// первая регистрация
	if ($_CAR ["car-freg"] != "0000-00-00") {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["car-freg"], "td2" => $_CAR ["car-freg"] ), TPL_NOCLEAR );
	}
	// пробег
	if ($_CAR ["car-mileage"] != 0) {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["car-mileage"], "td2" => $_CAR ["car-mileage"] . " км" ), TPL_NOCLEAR );
	}
	// тип топлива
	foreach ( $_Lang->fuel as $o => $v ) {
		if ($_CAR [$o] == 1) {
			$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => "Тип топлива", "td2" => $v ), TPL_NOCLEAR );
			break;
		}
	}
	// мощность
	if ($_CAR ["car-power"] != 0) {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["car-power"], "td2" => $_CAR ["car-power"] . " кВт (" . ceil ( $_CAR ["car-power"] * 1.36 ) . " PS)" ), TPL_NOCLEAR );
	}
	// коробка передач
	$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["car-gearbox"], "td2" => $_Lang->gearText [$_CAR ["car-gearbox"]] ), TPL_NOCLEAR );
	// объем
	if ($_CAR ["car-eng_volume"] != "") {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["car-eng_volume"], "td2" => $_CAR ["car-eng_volume"] ), TPL_NOCLEAR );
	}
	// число мест
	if ($_CAR ["car-n_seats"] != 0) {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["car-n_seats"], "td2" => $_CAR ["car-n_seats"] ), TPL_NOCLEAR );
	}
	// год выпуска
	if ($_CAR ["car-year"] != 0) {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => "Год выпуска", "td2" => $_CAR ["car-year"] ), TPL_NOCLEAR );
	}
	// Расход топлива
	// комбинированный:
	if ($_CAR ["car-fuel_rcomb"] != "") {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["car-fuel_rcomb"], "td2" => $_CAR ["car-fuel_rcomb"] ), TPL_NOCLEAR );
	}
	// городской
	if ($_CAR ["car-fuel_rcity"] != "") {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["car-fuel_rcity"], "td2" => $_CAR ["car-fuel_rcity"] ), TPL_NOCLEAR );
	}
	// загородный
	if ($_CAR ["car-fuel_rcountry"] != "") {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["car-fuel_rcountry"], "td2" => $_CAR ["car-fuel_rcountry"] ), TPL_NOCLEAR );
	}
	// CO2
	if ($_CAR ["car-co2_comb"] != "") {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["car-co2_comb"], "td2" => $_CAR ["car-co2_comb"] ), TPL_NOCLEAR );
	}
	// Число дверей:
	if ($_CAR ["car-n_dors"] != 0) {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["car-n_dors"], "td2" => $_CAR ["car-n_dors"] . "/" . ($_CAR ["car-n_dors"] + 1) ), TPL_NOCLEAR );
	}
	// Класс экологической безопасности:
	if ($_CAR ["car-safe-class"] != 0) {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["car-safe-class"], "td2" => "Евро" . $_CAR ["car-safe-class"] ), TPL_NOCLEAR );
	}
	// наклейка
	if ($_CAR ["car-safe-label"] != 0) {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["car-safe-label"], "td2" => $_CAR ["car-safe-label"] . " " . $_Lang->safeLabe [$_CAR ["car-safe-label"]] ), TPL_NOCLEAR );
	}
	// Количество владельцев транспортного средства:
	if ($_CAR ["car-n_owners"] != 0) {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["car-n_owners"], "td2" => $_CAR ["car-n_owners"] ), TPL_NOCLEAR );
	}
	// Общий осмотр:
	if ($_CAR ["o-check"] != "0000-00-00") {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["o-check"], "td2" => $_CAR ["o-check"] ), TPL_NOCLEAR );
	}
	// Ежегодная проверка на уровень выбросов:
	if ($_CAR ["o-ever-check"] != "0000-00-00") {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["o-ever-check"], "td2" => $_CAR ["o-ever-check"] ), TPL_NOCLEAR );
	}
	if ($_CAR ["o-new-check"] != "") {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["o-new-check"], "td2" => $_CAR ["o-new-check"] ), TPL_NOCLEAR );
	}
	// Климатическая установка:
	if ($_CAR ["car-climat-contr"] != 0) {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => $_Lang->Text ["car-climat-contr"], "td2" => $_Lang->climText [$_CAR ["car-climat-contr"]] ), TPL_NOCLEAR );
	}
	// декор
	$str = "";
	foreach ( $_Lang->decor as $o => $v ) {
		if ($_CAR [$o] == 1) {
			$str .= $v . " ";
		}
	}
	if ($str != "") {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => "Тип отделки", "td2" => $str ), TPL_NOCLEAR );
	}
	// цвет отделки
	$str = "";
	foreach ( $_Lang->d_color as $o => $v ) {
		if ($_CAR [$o] == 1) {
			$str .= $v . " ";
		}
	}
	if ($str != "") {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => "Цвет отделки", "td2" => $str ), TPL_NOCLEAR );
	}
	// Цвет:
	$str = "";
	foreach ( $_Lang->color as $o => $v ) {
		if ($_CAR [$o] == 1) {
			$str .= $v . " ";
		}
	}
	if ($str != "") {
		$tmpT ["car-info"] .= $_TPL->Show ( "tr", array ("td1" => "Цвет", "td2" => $str ), TPL_NOCLEAR );
	}
	// характеристики
	$opt = "";
	foreach ( $_Lang->optionArr as $o ) {
		if ($_CAR [$o] == 1) {
			if ($opt != "") {
				$opt .= ", ";
			}
			$opt .= $_Lang->Text [$o];
		}
	}
	$tmpT ["car-options"] = $opt;
	// Описание 
	//$tmpT["car-other"] = $_CAR["o-info"];
	$_TPL->Clear ( "img" );
	$_TPL->Clear ( "tr" );
	// формаирование страницы */
	$_Main->MakePage ( "tabDetail_3", $tmpT, "page-detail" );
	return 0;
}
?>